package cn.usian.product.controller;

import cn.usian.jyzx.model.dto.h5.ProductSkuDto;
import cn.usian.jyzx.model.entity.product.ProductSku;
import cn.usian.jyzx.model.vo.common.Result;
import cn.usian.product.service.ProductSkuService;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping(value = "/api/product")
public class ProductController {

    @Autowired
    private ProductSkuService productSkuService;

    @GetMapping(value = "/index")
    public Result index(){
        return productSkuService.index();
    }

    @GetMapping(value = "/{page}/{limit}")
    public Result<PageInfo<ProductSku>> findByPage(@PathVariable("page") Integer page, @PathVariable("limit") Integer limit, ProductSkuDto dto){
        return productSkuService.findByPage(page,limit,dto);
    }
}
